<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibQQt: QQtAudioManager Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibQQt
   &#160;<span id="projectnumber">v3.1</span>
   </div>
   <div id="projectbrief">开源、跨平台Qt应用程序框架中间件</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#signals">Signals</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="class_q_qt_audio_manager-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">QQtAudioManager Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>The <a class="el" href="class_q_qt_audio_manager.html" title="The QQtAudioManager class 为用户提供连接声卡的通道，一个Manager包括：输入选择，输出选择，输入读信号，...">QQtAudioManager</a> class 为用户提供连接声卡的通道，一个Manager包括：输入选择，输出选择，输入读信号，输出函数。 关于回听：打开输入，不开输出=QAudioInput，开输出增加QAudioOutput=回听。 关于输出：可以按照Timer时序write音频数据帧Bytes到输出设备。 关于输入：可以在readyRead里面接收到来自选定输入设备的音频帧。 地位等高于QQtWavSoundEffect，目标为用户提供声卡输入端（音频输入设备）（拾音器）的音频数据帧，附加回听功能。（地位：封装层次） QQtWavSoundEffect，目标为用户提供连续播放Wav的能力。  
 <a href="class_q_qt_audio_manager.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="qqtaudiomanager_8h_source.html">qqtaudiomanager.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for QQtAudioManager:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_q_qt_audio_manager.png" usemap="#QQtAudioManager_map" alt=""/>
  <map id="QQtAudioManager_map" name="QQtAudioManager_map">
<area href="class_q_qt_sound_effect.html" title="The QQtAudioEffect class 未实现 " alt="QQtSoundEffect" shape="rect" coords="0,112,119,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="signals"></a>
Signals</h2></td></tr>
<tr class="memitem:addec5c23fbb3eff8adc436ff9c3e7dcc"><td class="memItemLeft" align="right" valign="top"><a id="addec5c23fbb3eff8adc436ff9c3e7dcc"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>readyRead</b> ()</td></tr>
<tr class="separator:addec5c23fbb3eff8adc436ff9c3e7dcc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:af4c15a60e54ddcb24c629cd84faf0da6"><td class="memItemLeft" align="right" valign="top"><a id="af4c15a60e54ddcb24c629cd84faf0da6"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>QQtAudioManager</b> (QObject *parent=nullptr)</td></tr>
<tr class="separator:af4c15a60e54ddcb24c629cd84faf0da6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aee4d1db7a21c13b55dea0febb71bf8a8"><td class="memItemLeft" align="right" valign="top"><a id="aee4d1db7a21c13b55dea0febb71bf8a8"></a>
QAudioDeviceInfo &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>inputDeviceInfo</b> ()</td></tr>
<tr class="separator:aee4d1db7a21c13b55dea0febb71bf8a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af9e51f192c5ac4335f375455b67d48df"><td class="memItemLeft" align="right" valign="top"><a id="af9e51f192c5ac4335f375455b67d48df"></a>
QAudioDeviceInfo &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>outputDeviceInfo</b> ()</td></tr>
<tr class="separator:af9e51f192c5ac4335f375455b67d48df"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab1fd943d45b78a71e645f81ad35017af"><td class="memItemLeft" align="right" valign="top">QAudioFormat &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_qt_audio_manager.html#ab1fd943d45b78a71e645f81ad35017af">inputAudioFormat</a> (void)</td></tr>
<tr class="separator:ab1fd943d45b78a71e645f81ad35017af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac4fceb30fc9ce05da564587c5397f4d3"><td class="memItemLeft" align="right" valign="top"><a id="ac4fceb30fc9ce05da564587c5397f4d3"></a>
QAudioFormat &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>outputAudioFormat</b> (void)</td></tr>
<tr class="separator:ac4fceb30fc9ce05da564587c5397f4d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a52342f883617ae2eff12813ae171810c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_qt_audio_manager.html#a52342f883617ae2eff12813ae171810c">startInput</a> ()</td></tr>
<tr class="separator:a52342f883617ae2eff12813ae171810c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acebdbef5acc2aa62c437233b70003960"><td class="memItemLeft" align="right" valign="top"><a id="acebdbef5acc2aa62c437233b70003960"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>stopInput</b> ()</td></tr>
<tr class="separator:acebdbef5acc2aa62c437233b70003960"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a26393ce110da69d23d6988496ddd7d0a"><td class="memItemLeft" align="right" valign="top"><a id="a26393ce110da69d23d6988496ddd7d0a"></a>
QByteArray&#160;</td><td class="memItemRight" valign="bottom"><b>readAll</b> ()</td></tr>
<tr class="separator:a26393ce110da69d23d6988496ddd7d0a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73a69f6ed2d2ea740974d17b26dcbc14"><td class="memItemLeft" align="right" valign="top"><a id="a73a69f6ed2d2ea740974d17b26dcbc14"></a>
QByteArray&#160;</td><td class="memItemRight" valign="bottom"><b>read</b> (qint64 maxlen)</td></tr>
<tr class="separator:a73a69f6ed2d2ea740974d17b26dcbc14"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0fa3c596503da0410d32dbf332594ff2"><td class="memItemLeft" align="right" valign="top"><a id="a0fa3c596503da0410d32dbf332594ff2"></a>
QAudioInput *&#160;</td><td class="memItemRight" valign="bottom"><b>inputManager</b> ()</td></tr>
<tr class="separator:a0fa3c596503da0410d32dbf332594ff2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa47bf607aeac9416151e12d08784a0b9"><td class="memItemLeft" align="right" valign="top"><a id="aa47bf607aeac9416151e12d08784a0b9"></a>
QIODevice *&#160;</td><td class="memItemRight" valign="bottom"><b>inputDevice</b> ()</td></tr>
<tr class="separator:aa47bf607aeac9416151e12d08784a0b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a094ba272d6a680bf2343b6b496ae1e8d"><td class="memItemLeft" align="right" valign="top"><a id="a094ba272d6a680bf2343b6b496ae1e8d"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>startOutput</b> ()</td></tr>
<tr class="separator:a094ba272d6a680bf2343b6b496ae1e8d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a603296c1b269fde726488c19af28c9b3"><td class="memItemLeft" align="right" valign="top"><a id="a603296c1b269fde726488c19af28c9b3"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>stopOutput</b> ()</td></tr>
<tr class="separator:a603296c1b269fde726488c19af28c9b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9f3fdf8ee9f60f4838979f1c85d7a60e"><td class="memItemLeft" align="right" valign="top"><a id="a9f3fdf8ee9f60f4838979f1c85d7a60e"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>write</b> (const QByteArray &amp;bytes)</td></tr>
<tr class="separator:a9f3fdf8ee9f60f4838979f1c85d7a60e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab3546966142d768cb01af5054ace2133"><td class="memItemLeft" align="right" valign="top"><a id="ab3546966142d768cb01af5054ace2133"></a>
QAudioOutput *&#160;</td><td class="memItemRight" valign="bottom"><b>outputManager</b> ()</td></tr>
<tr class="separator:ab3546966142d768cb01af5054ace2133"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af96dccce590726bd4fc5517fe7b68d62"><td class="memItemLeft" align="right" valign="top"><a id="af96dccce590726bd4fc5517fe7b68d62"></a>
QIODevice *&#160;</td><td class="memItemRight" valign="bottom"><b>outputDevice</b> ()</td></tr>
<tr class="separator:af96dccce590726bd4fc5517fe7b68d62"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4d6f5f8d5d8f5ee9b32fdd920cea9b3b"><td class="memItemLeft" align="right" valign="top"><a id="a4d6f5f8d5d8f5ee9b32fdd920cea9b3b"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>startDefaultInput</b> ()</td></tr>
<tr class="separator:a4d6f5f8d5d8f5ee9b32fdd920cea9b3b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a51eeafdae59df60e3fbf04c1a0045636"><td class="memItemLeft" align="right" valign="top"><a id="a51eeafdae59df60e3fbf04c1a0045636"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>startDefaultOutput</b> ()</td></tr>
<tr class="separator:a51eeafdae59df60e3fbf04c1a0045636"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a6551c9d1d11f95a1be7b4c87dce763cb"><td class="memItemLeft" align="right" valign="top">static QList&lt; QAudioDeviceInfo &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_qt_audio_manager.html#a6551c9d1d11f95a1be7b4c87dce763cb">availableInputDevices</a> ()</td></tr>
<tr class="separator:a6551c9d1d11f95a1be7b4c87dce763cb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae124fe0847c7d99a4f744bdf71b2c00e"><td class="memItemLeft" align="right" valign="top"><a id="ae124fe0847c7d99a4f744bdf71b2c00e"></a>
static QList&lt; QAudioDeviceInfo &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>availableOutputDevices</b> ()</td></tr>
<tr class="separator:ae124fe0847c7d99a4f744bdf71b2c00e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75353f93b00230f6415cc58cf49a20a3"><td class="memItemLeft" align="right" valign="top"><a id="a75353f93b00230f6415cc58cf49a20a3"></a>
static QAudioDeviceInfo&#160;</td><td class="memItemRight" valign="bottom"><b>defaultInputDevice</b> ()</td></tr>
<tr class="separator:a75353f93b00230f6415cc58cf49a20a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a02794494d00c892b990d693ff80a66a3"><td class="memItemLeft" align="right" valign="top"><a id="a02794494d00c892b990d693ff80a66a3"></a>
static QAudioDeviceInfo&#160;</td><td class="memItemRight" valign="bottom"><b>defaultOutputDevice</b> ()</td></tr>
<tr class="separator:a02794494d00c892b990d693ff80a66a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The <a class="el" href="class_q_qt_audio_manager.html" title="The QQtAudioManager class 为用户提供连接声卡的通道，一个Manager包括：输入选择，输出选择，输入读信号，...">QQtAudioManager</a> class 为用户提供连接声卡的通道，一个Manager包括：输入选择，输出选择，输入读信号，输出函数。 关于回听：打开输入，不开输出=QAudioInput，开输出增加QAudioOutput=回听。 关于输出：可以按照Timer时序write音频数据帧Bytes到输出设备。 关于输入：可以在readyRead里面接收到来自选定输入设备的音频帧。 地位等高于QQtWavSoundEffect，目标为用户提供声卡输入端（音频输入设备）（拾音器）的音频数据帧，附加回听功能。（地位：封装层次） QQtWavSoundEffect，目标为用户提供连续播放Wav的能力。 </p>
<p>处理声音三要点 声音的格式 ，也就是声音三要素，输入一个、输出一个，manager对其分开管理，但是建议用户合并为一个置等。通道数、采样位宽、采样率 声音设备 ，输入一个、输出一个，manager管理start等接口，manager内部的inputManager和outputManager负责其他接口。 声音设备的读写出入口 ，manager管理，包括可读信号和写入函数。</p>
<p>先确定输入、输出设备， Qt提供建议格式，一般建议用户选择使用输出设备的建议格式，或者使用两个公共的格式。 然后，读写设备即可。 manager把读写声音设备当做读写一个设备处理。支持本地声卡，蓝牙连接的声卡，hdmi接口上的声卡，其他接口上的声卡。只要系统显示的，一般都支持。</p>
<p>*******使用QQtAudioManager，用户关注输入、输出设备的切换，和输入、输出格式的改变即可，其他的不必关注。*******</p>
<p>原理： 声音三要素： 采样率， 量化精度， 声道 通常我们用一位二进制表示两种状态， 如1表示高电平， 0表示低电平。在音频领域里，如只用一位二进制表示声音，那么只能表示发声和不发声两种状态（蜂鸣器）。 如果使用过音频分析软件会发现，声音是由连续的不规则的波形来表示， 根本不可能用一位二进制数据表示一个人发出的声音。但可以用多位二进制的数据来表示(音频里通常是用8位或者16位). 如用8位数据表示 0 &ndash; 20KHz: 0xff可表示20KHz, 0xfe表示19.92KHz, 0xfc表示19.84KHz .... 把声音经过测量转换成多位的二进制数据就是在计算机系统里存储的原始声音数据(也叫pcm数据)， 数据的位数就是量化精度。通常是8位/16位</p>
<p>采样率就是声音转换成二进制数据的频率，常用的采样率有： 8000, 11025, 22050, 44100, 48000 从声音的还原角度来说采样率越高，质量就越好。</p>
<p>声音就是表示声音源的通道。嵌入式系统里通常是单声道/双声道. CD唱片通常是发烧友所用的，片中没有图像。而一张蝶片有650M左右，为什么只有十多首歌曲？ 算一算： 高保真肯定是用最高的采样率48000, 量化精度16位(2字节)， 立体声2声道. 一首歌通常200秒 48000 * 2 * 2 * 200 = 38400000字节, 大概38M一首歌曲</p>
<p>****由于Qt 实现上的原因，暂时仅仅支持桌面。在安卓上在关闭时会崩溃**** </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a6551c9d1d11f95a1be7b4c87dce763cb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6551c9d1d11f95a1be7b4c87dce763cb">&#9670;&nbsp;</a></span>availableInputDevices()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">QList&lt; QAudioDeviceInfo &gt; QQtAudioManager::availableInputDevices </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>选择输入、输出设备 </p>

</div>
</div>
<a id="ab1fd943d45b78a71e645f81ad35017af"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab1fd943d45b78a71e645f81ad35017af">&#9670;&nbsp;</a></span>inputAudioFormat()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QAudioFormat &amp; QQtAudioManager::inputAudioFormat </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>选择音频流的格式 </p>

</div>
</div>
<a id="a52342f883617ae2eff12813ae171810c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a52342f883617ae2eff12813ae171810c">&#9670;&nbsp;</a></span>startInput()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void QQtAudioManager::startInput </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>操作输入、输出设备 </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>R:/Develop/a0-develop/LibQQt/src/multimedia/<a class="el" href="qqtaudiomanager_8h_source.html">qqtaudiomanager.h</a></li>
<li>R:/Develop/a0-develop/LibQQt/src/multimedia/qqtaudiomanager.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
